import request from '@/utils/request.js'
// import store from "@/store/index.js"

export const login = data =>request({
    method:'POST',
    url:'/v1_0/authorizations',
    data,
})

export const sendSms = mobile => request({
    method:'GET',
    url:`/v1_0/sms/codes/${mobile}`,
})

// 获取用户自己的信息
export const getUserData = () => {
    return request({
        method:'GET',
        url:'/v1_0/user'
        // headers:{
        //     Authorization:`Bearer ${store.state.user.token}`
        // }
    })
}

// 展示频道列表
export const getUserChannels = ()=>{
    return request({
        method:'GET',
        url:'/v1_0/user/channels'
    })
}

// 请求文章列表
export const getArticleList = (params) => {
    return request({
        method:'GET',
        url:'/v1_0/articles',
        params,
    })
}

// 获取用户个人资料
export const getProfileList = () => request({
    method:'GET',
    url:'/v1_0/user/profile'
})

// 修改用户的名字
export const updateUserProfile = data => request({
    method:'PATCH',
    url:'/v1_0/user/profile',
    data,
})

// 用户图片上传修改
export const updateUserPhoto = data => request({
    method:'PATCH',
    url:'/v1_0/user/photo',
    data,
})

